<template>
  <el-button type="danger" icon="el-icon-delete" size="mini" @click="removeAgreementById(agreementId)">审核</el-button>
</template>


<script>
import { removeAgreementByIdRequest} from "@/network/agreement";

export default {
  name: "AgreementRemove",
  props: {
    agreementId: {
      type: Number|String,
      required: true
    }
  },
  methods: {
    // 根据ID审核农户信息
    removeAgreementById(id) {
      this.$confirm('此操作将删除该协议, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        removeAgreementByIdRequest(id).then(({code,msg}) => {
          if (code !== 200) return this.$errorMessage(msg);
          this.$successMessage('删除成功')
          // 重新获取协议列表
          this.$emit('update-list')
        });
      }).catch(() => {
        this.alertMessage('已取消删除','info');
      });
    },
  }
}
</script>

<style scoped>

</style>
